//
//  HttpURLConnection.h
//  WxSdk
//
//  Created by fusuwei on 14-9-17.
//  Copyright (c) 2014年 网信金融集团. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "IChatProgressDelegate.h"
#import "IChatProgressDelegate.h"




@protocol HttpURLConnectionDelegate <NSObject>
@optional
- (void)setProgress:(float)newProgress;
@end




typedef void(^CompleteBlock_t)(NSData *data);
typedef void(^ErrorBlock_t)(NSError *error);

@interface HttpURLConnection : NSURLConnection <NSURLConnectionDataDelegate>
{
    NSMutableData *data_;
    CompleteBlock_t completeBlock_;
    ErrorBlock_t errorBlock_;
    
    long long contentlength;
}



@property (nonatomic,assign) id <HttpURLConnectionDelegate>progressDelegate;

+ (id)request:(NSString *)requestUrl progress:(id<HttpURLConnectionDelegate>)progress completeBlock:(CompleteBlock_t)compleBlock errorBlock:(ErrorBlock_t)errorBlock;

- (id)initWithRequest:(NSString *)requestUrl progress:(id<HttpURLConnectionDelegate>)progress completeBlock:(CompleteBlock_t)compleBlock errorBlock:(ErrorBlock_t)errorBlock;

+ (NSData *)requestSynUrl:(NSString *)requestUrl;

@end



